<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of tes
 *
 * @author pudy
 */
class Tes extends CI_Controller {

    //put your code here

    function __construct() {
        parent::__construct();
        $this->load->helper(array('form', 'url'));
    }

    public function index() {
        //echo "tes halo halo";
        $this->load->view('tes/upload_view', array('error' => ' '));
    }

    function do_upload() {
        $upload_path = './uploads/1';
        if (!file_exists($upload_path)) {
            $create = mkdir($upload_path);
        }
        $config['upload_path'] = $upload_path;
        $config['allowed_types'] = 'gif|jpg|png|3gp';
        $config['file_name'] = 'file1_tes';
        //$config['max_size'] = '100';
//		$config['max_width']  = '1024';
//		$config['max_height']  = '768';

        $this->load->library('upload', $config);

        if (!$this->upload->do_upload()) {
            $error = array('error' => $this->upload->display_errors());

            $this->load->view('tes/upload_view', $error);

            //echo "upload gagal";
        } else {
            $data = array('upload_data' => $this->upload->data());

            $this->load->view('tes/success_page', $data);
            //echo "upload berhasil";
        }
    }

}

?>
